ROOT=../..
BUILD_DIR= ../build
_VERSION=

ifeq ($(_VERSION),release)
CXXFLAGS= -O3 -I./utils -I $(ROOT)/common/include -I . -I .. -I../new -D_USEDAEMON 
LDFLAGS= -L $(ROOT)/common/lib
LIBS=-lsvcommon -lresolv $(ROOT)/common/lib/libcl.a -ldhdvr -ldhnetsdk -ldhparser 
else
CXXFLAGS= -g -I./utils -I $(ROOT)/common/include -I . -I .. -I../new 
LDFLAGS= -L $(ROOT)/common/lib
LIBS=-lsvcommon -lresolv $(ROOT)/common/lib/libcl.a -ldhdvr -ldhnetsdk -ldhparser 
	
endif
SUBDIRS=utils
CPP_FILES=$(wildcard *.cpp)
HPP_FILES=$(wildcard *.hpp)
OBJ_FILES=$(patsubst %.cpp,%.o,$(CPP_FILES))


.PHONY: all clean submake
all: init $(OBJ_FILES) 

init:
	mkdir -p $(BUILD_DIR) 

$(OBJ_FILES):$(CPP_FILES)
	$(CXX) -c $(CXXFLAGS) $(patsubst %.o,%.cpp,$@) -o $(BUILD_DIR)/$@

#submake:$(SUBDIRS)
#	make -C $<

clean:
	rm -rf $(addprefix $(BUILD_DIR)/, $(OBJ_FILES) )

ut_sel:
	$(CXX) $(CXXFLAGS) $(LDFLAGS) $(LIBS) -o $@ unit_test/test_selector.cpp selector.cpp
